﻿<Window x:Class="DataBinding.ElementToElementBinding"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ElementToElementBinding" Height="300" Width="300"
    >
  <StackPanel Margin="5">

    <Slider Name="sliderFontSize" Margin="3" Minimum="1" Maximum="40" Value="10" TickFrequency="1" IsSnapToTickEnabled="True" TickPlacement="TopLeft"></Slider>

    
    <TextBlock Margin="10" Name="lblSampleText" 
           FontSize="{Binding ElementName=sliderFontSize, Path=Value, Mode=TwoWay}"
           Text="Simple Text">
    </TextBlock>

    <StackPanel Orientation="Horizontal" >
      <Button Margin="5" Padding="3" Click="cmd_SetSmall">Set to Small</Button>
      <Button Margin="5" Padding="3" Click="cmd_SetNormal">Set to Normal</Button>
      <Button Margin="5" Padding="3" Click="cmd_SetLarge">Set to Large</Button>
    </StackPanel>

    <StackPanel Orientation="Horizontal" Margin="5">
      <TextBlock VerticalAlignment="Center" xml:space="preserve">Exact Size:  </TextBlock>
      <TextBox Name="txtBound" Text="{Binding ElementName=lblSampleText, Path=FontSize, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, Delay=500}" Width="100"></TextBox>
    </StackPanel>

        <Button Margin="5" Padding="3" HorizontalAlignment="Left" Click="cmd_GetBoundObject">Get Bound Object</Button>
    </StackPanel>
  

</Window>
